Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes | Static Protected Attributes

vfsStreamWrapper Class Reference

Public Member Functions

 stream_open ($path, $mode, $options, $opened_path)
 stream_close ()
 stream_read ($count)
 stream_write ($data)
 stream_eof ()
 stream_tell ()
 stream_seek ($offset, $whence)
 stream_flush ()
 stream_stat ()
 unlink ($path)
 rename ($path_from, $path_to)
 mkdir ($path, $mode, $options)
 rmdir ($path, $options)
 dir_opendir ($path, $options)
 dir_readdir ()
 dir_rewinddir ()
 dir_closedir ()
 url_stat ($path, $flags)

Static Public Member Functions

static register ()
static setRoot (vfsStreamContent $root)
static getRoot ()

Data Fields

const READ = 'r'
const TRUNCATE = 'w'
const APPEND = 'a'
const WRITE = 'x'
const READONLY = 0
const WRITEONLY = 1
const ALL = 2

Protected Member Functions

 getContent ($path)
 getContentOfType ($path, $type)
 splitPath ($path)
 resolvePath ($path)
 calculateMode ($mode, $extended)

Protected Attributes

 $mode
 $content
 $dir
 $dirIterator

Static Protected Attributes

static $registered = false
static $root

Member Function Documentation

calculateMode ( mode,
extended 
) [protected]

calculates the file mode

Parameters:
string$modeopening mode: r, w, a or x
bool$extendedtrue if + was set with opening mode
Returns:
int
dir_closedir (  )

closes directory

Returns:
bool
dir_opendir ( path,
options 
)

opens a directory

Parameters:
string$path
int$options
Returns:
bool
dir_readdir (  )

reads directory contents

Returns:
string
dir_rewinddir (  )

reset directory iteration

Returns:
bool
getContent ( path ) [protected]

returns content for given path

Parameters:
string$path
Returns:
vfsStreamContent
getContentOfType ( path,
type 
) [protected]

returns content for given path but only when it is of given type

Parameters:
string$path
int$type
Returns:
vfsStreamContent
static getRoot (  ) [static]

returns the root content

Returns:
vfsStreamContent
mkdir ( path,
mode,
options 
)

creates a new directory

Parameters:
string$path
int$mode
int$options
Returns:
bool
static register (  ) [static]

method to register the stream wrapper

Please be aware that a call to this method will reset the root element to null. If the stream is already registered the method returns silently. If there is already another stream wrapper registered for the scheme used by vfsStream a vfsStreamException will be thrown.

Exceptions:
vfsStreamException
rename ( path_from,
path_to 
)

rename from one path to another

Parameters:
string$path_from
string$path_to
Returns:
bool
Author:
Benoit Aubuchon
resolvePath ( path ) [protected]

helper method to resolve a path from /foo/bar/. to /foo/bar

Parameters:
string$path
Returns:
string
rmdir ( path,
options 
)

removes a directory

Parameters:
string$path
int$options
Returns:
bool
Todo:
consider $options with STREAM_MKDIR_RECURSIVE
static setRoot ( vfsStreamContent root ) [static]

sets the root content

Parameters:
vfsStreamContent$root
splitPath ( path ) [protected]

splits path into its dirname and the basename

Parameters:
string$path
Returns:
array
stream_close (  )

closes the stream

stream_eof (  )

checks whether stream is at end of file

Returns:
bool
stream_flush (  )

flushes unstored data into storage

Returns:
bool
stream_open ( path,
mode,
options,
opened_path 
)

open the stream

Parameters:
string$paththe path to open
string$modemode for opening
string$optionsoptions for opening
string$opened_pathfull path that was actually opened
Returns:
bool
stream_read ( count )

read the stream up to $count bytes

Parameters:
int$countamount of bytes to read
Returns:
string
stream_seek ( offset,
whence 
)

seeks to the given offset

Parameters:
int$offset
int$whence
Returns:
bool
stream_stat (  )

returns status of stream

Returns:
array
stream_tell (  )

returns the current position of the stream

Returns:
int
stream_write ( data )

writes data into the stream

Parameters:
string$data
Returns:
int amount of bytes written
unlink ( path )

remove the data under the given path

Parameters:
string$path
Returns:
bool
url_stat ( path,
flags 
)

returns status of url

Parameters:
string$pathpath of url to return status for
?$flags flags set by the stream API
Returns:
array

Field Documentation

const ALL = 2

file mode: read and write

const APPEND = 'a'

set file pointer to end, append new data

const READ = 'r'

open file for reading

const READONLY = 0

file mode: read only

const TRUNCATE = 'w'

truncate file

const WRITE = 'x'

set file pointer to start, overwrite existing data

const WRITEONLY = 1

file mode: write only


The documentation for this class was generated from the following file: